﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="sample"
    targetNamespace="http://www.king.com/foo"
    elementFormDefault="unqualified"
    xmlns="http://www.king.com/foo"
    xmlns:bar2="http://www.king.com/bar"
    xmlns:bar="http://www.king.com/bar"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:import schemaLocation="bar.xsd" namespace="http://www.king.com/bar" />

  <xs:element name="content">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="bike" type="ToddlerMountainBikeSizes"/>
        <xs:element name="type" type="someType"/>
        <xs:element name="simple" type="simpleContentType"/>
        <xs:element name="complex" type="complexContentType"/>
        <xs:element name="superSimple" type="superSimpleContentType"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <xs:element name="foo" type="xs:string" />
  
  <xs:complexType name="list">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:any namespace="##any" />
    </xs:sequence>
  </xs:complexType>

  <xs:element name="lister" type="dList"/>
  
  <xs:simpleType name="union">
    <xs:union memberTypes="xs:string xs:int"/>
  </xs:simpleType>

  <xs:simpleType name="aList">
    <xs:list itemType="xs:string">
    </xs:list>
  </xs:simpleType>

  <xs:simpleType name="dList">
    <xs:restriction base="aList">
      <xs:enumeration value="1 2 3"/>
      <xs:enumeration value="1 2 3 4"/>
      <xs:enumeration value="1 2 3  4"/>
    </xs:restriction>
  </xs:simpleType>
  
  <xs:complexType name="simpleContentType">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="attr"/>
        <xs:attribute name="attr2"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="superSimpleContentType">
    <xs:simpleContent>
      <xs:restriction base="simpleContentType">
        <xs:attribute name="attr"/>
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="complexContentType">
    <xs:complexContent>
      <xs:extension base="list"/>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="someType">
    <xs:complexContent>
      <xs:restriction base="xs:anyType">
        <xs:sequence>
          <xs:element name="aString" type="xs:string"/>
        </xs:sequence>
        <xs:attribute name="aString" type="xs:string"/>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="someOtherType">
    <xs:sequence>
      <xs:element name="aString" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="aString" type="xs:string"/>
  </xs:complexType>
  
  <xs:complexType name="yetSomeOtherType">
    <xs:complexContent>
      <xs:restriction base="xs:anyType">
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
  
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="z" type="simpleContentType" />
        <xs:element name="a" type="foo-type" />
        <xs:element name="b" type="bar:bar-type"/>
        <xs:element name="member" type="xs:string" />
        <xs:group ref="bar:group"/>
        <!--<xs:any namespace="##any" maxOccurs="unbounded" />-->
        <xs:any namespace="##local" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="fooElem" type="xs:string" />

  <xs:complexType name="fooElem-type">
  </xs:complexType>

  <!--<xs:element name="elem">
    <xs:complexType>
      <xs:attribute name="type" type="xs:string"/>
      <xs:attributeGroup ref="bar:barType"/>
      <xs:attributeGroup ref="bar:barType2"/>
    </xs:complexType>
  </xs:element>-->

  <xs:complexType name="foo-type">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
      <xs:element name="fooLeaf" type="xs:string" />
    </xs:sequence>
  </xs:complexType>

  <xs:simpleType name="mountainbikesize">
    <xs:restriction base="xs:string">
      <xs:enumeration value="small"/>
      <xs:enumeration value="medium"/>
      <xs:enumeration value="large"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="FamilyMountainBikeSizes">
    <xs:simpleContent>
      <xs:extension base="mountainbikesize">
        <xs:attribute name="familyMember" type="xs:string" />
        <xs:anyAttribute namespace="##any" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="ChildMountainBikeSizes">
    <xs:simpleContent>
      <xs:restriction base="FamilyMountainBikeSizes" >
        <xs:enumeration value="small"/>
        <xs:enumeration value="medium"/>
        <xs:attribute name="foo" type="xs:string" />
        <xs:attribute name="bar" type="xs:string" />
        <xs:anyAttribute namespace="##any" />
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>

  <xs:complexType name="ToddlerMountainBikeSizes">
    <xs:simpleContent>
      <xs:restriction base="ChildMountainBikeSizes" >
        <xs:enumeration value="small"/>
        <xs:attribute name="baz" type="xs:string" />
      </xs:restriction>
    </xs:simpleContent>
  </xs:complexType>

  <xs:simpleType name="List">
    <xs:list itemType="xs:string">
      
    </xs:list>
  </xs:simpleType>
  
</xs:schema>

